package com.joshua.hello.service.impl;

import com.joshua.hello.entity.UserEntity;
import com.joshua.hello.mapper.UserMapper;
import com.joshua.hello.service.UserService;
import io.micrometer.common.util.StringUtils;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import java.util.Objects;


@Service
public class UserServiceImpl implements UserService {
    private final Logger log = LoggerFactory.getILoggerFactory().getLogger("UserService");

    @Resource
    private UserMapper userMapper;

    @Override
    public UserEntity getUserById(Long id) {
        log.info("查询用户，id:{}", id);
        if (Objects.isNull(id)) {
            log.error("参数非法，用户id不能为空！");
        }
        return userMapper.selectById(id);
    }
}
